define(['model/new', 'text!../../tpl/nav.html', 'text!../../tpl/new/new.html', 'util/tip' , 'config'], function(newModel, navTemplate, template, tip, CONSTANT){
    var NewView = Backbone.View.extend({

        el: $('#view-container'),

        initialize: function(options) {
            this.tid = options.tid;
            this.nid = options.nid;
        },

        render: function() {

            var nav = [{
                title: CONSTANT.AREA[this.tid],
                href: '#/newtype/' + this.tid
            }, {
                title: '资讯'
            }]

            this.$el.html(_.template(navTemplate)(nav)); //现将导航渲染

            var self = this;
            var query = new Bmob.Query(newModel);

            tip.showTip('加载中...', true);
            query.get(this.nid, {
                success: function(results) {
                    self.template = _.template(template);
                    self.$el.append(self.template(results.toJSON()));
                    tip.hideTip();
                    return self;
                },
                error: function(error) {
                    tip.hideTip();
                    return self;
                }
            });

        }
	})
	return NewView;
});
